package com.asset.dispoal.dicData.service.commom;

import com.asset.dispoal.dicData.domain.db.entity.GbDictData;
import com.asset.dispoal.dicData.domain.db.mapper.GbDictDataMapper;
import com.asset.dispoal.dicData.dto.GbDictDataRequest;
import com.asset.dispoal.dicData.service.converter.GbDictDataConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/2/24$
 */
@Component
public class UpdateDicDataCommand implements BaseCommand<GbDictDataRequest, Result> {


    @Autowired
    GbDictDataMapper gbDictDataMapper;

    @Override
    public Result execute(GbDictDataRequest gbDictDataRequest) {
        final GbDictData gbDictData = GbDictDataConverter.INSTANCE.reqToDo(gbDictDataRequest);
        gbDictDataMapper.update(gbDictData);
        return Result.ok();
    }
}
